<?php include 'application/views/header.php' ?>
<?php // echo '<pre>'; print_r($Product); die; ?>
<script type="text/javascript" src="<?php echo base_url() ?>public/ckeditor/ckeditor.js"></script>
<script type="text/javascript" src="<?php echo base_url() ?>public/ckfinder/ckfinder.js"></script>
<h4 class="page-title">Sản phẩm</h4>
<div class="flash-message">
    <?php if(is_array($this->session->flashdata('message'))): ?>
        <?php foreach($this->session->flashdata('message') as $item): ?>
            <div><?php echo $item ?></div>
        <?php endforeach; ?>
    <?php else: ?>
        <div><?php echo $this->session->flashdata('message') ?></div>
    <?php endif; ?>
</div>
<form accept="<?php echo base_url() ?>product/edit/<?php echo $Product['ProductId'] ?>" 
accept=""method="post" id="frmPageEdit" enctype="multipart/form-data">
    <table width="100%" class="form page-edit">
       <tr>
            <th>Mã số sản phẩm</th>
            <td><?php echo $Product['ProductId'] ?></td>
       </tr>
       <tr>
            <th>Tên sản phẩm</th>
            <td><input type="text" value="<?php echo $Product['ProductName'] ?>" name="ProductName" id="ProductName"/></td>
       </tr>
       <tr>
            <th>Mô tả ngắn của sản phẩm</th>
            <td>                
                <textarea name="ProductDescription" id="ProductDescription"><?php echo $Product['ProductDescription'] ?></textarea>
            </td>
       </tr>
       <tr>
            <th>Nội dung sản phẩm</th>
            <td>
                <textarea id="ProductDetail" name="ProductDetail"><?php echo $Product['ProductDetail'] ?></textarea>
            </td>
       </tr>
       <tr>
            <th>Hình ảnh sản phẩm</th>
            <td>
                <?php if(!empty($Product['Image'])): ?>
                    <img width="150" src="<?php echo $this->config->item('base_download') ?>/products/<?php echo $Product['Image'] ?>"/><br/>
                <?php endif; ?>
                <input type="file" name="Image" id="Image" />
            </td>
       </tr>
        <tr>
            <th>Ẩn hiện sản phẩm</th>
            <td><input <?php echo ($Product['Visible'] == 1 ? 'checked="checked"' : '') ?>" type="checkbox" value="1" name="Visible" id="Visible"  /></td>
       </tr>
    </table>
    <div class="clr button-set">
        <input type="submit" value="Lưu nội dung" id="btnSave" />
        <input type="reset" value="Hủy nội dung vừa nhập" id="btnReset" />
        <input type="button" value="Về danh sách sản phẩm" id="btnBack" />
    </div>
</form>
<?php include 'application/views/footer.php' ?>
<script>
$('#btnBack').click(function(){
    window.location.href = '<?php echo base_url() ?>product.html'; 
});
var ck = CKEDITOR.replace( 'ProductDetail', { toolbar : 'Full'});
CKFinder.setupCKEditor( ck, { 
    basePath : '/admin/public/ckfinder/' 
} ) ;
</script>